import React from 'react';
import { PageContainer } from '@ant-design/pro-layout';
import { Card } from 'antd';
import { message } from "antd/es";
import ProForm, { ProFormText } from "@ant-design/pro-form";
import { request } from "@@/plugin-request/request";

export default (): React.ReactNode => {


  return (
    <PageContainer>
      <Card>
        <ProForm
          onFinish={async (values) => {
            const result = await request(`${process.env.hostname}/api/changePassword`, {
              method: 'post',
              requestType: 'form',
              data: values
            })
            if (result.success) {
              message.success('密码修改成功,下次登录请使用新密码登录');
            }

          }}
        >
          <ProForm.Group>
            <ProFormText.Password width="lg" name="oldPassword" label="原密码" placeholder="" />
          </ProForm.Group>
          <ProForm.Group>
            <ProFormText.Password width="lg" name="newPassword" label="新密码" placeholder="" />
          </ProForm.Group>
        </ProForm>

      </Card>
    </PageContainer>
  )
}
